package com.aier.admin_new.service.impl;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;

import com.aier.admin_new.entity.RoleUsers;
import com.aier.admin_new.entity.mapper.RoleUsersMapper;
import com.aier.admin_new.service.IRoleService;
import com.aier.common.dao.ICommonDAO;

@Component("roleService")
public class RoleServiceImpl implements IRoleService {
	
    @Resource(name = "commonDao")
    private ICommonDAO commonDao;
	
	@Override
	public List<RoleUsers> searchRoleUsers(long uid,int sid) {
		return (List<RoleUsers>) commonDao.list("select * from role_users where uid = ? and sid =? ", new Object []{ uid ,sid}, new RoleUsersMapper());
	}

	@Override
	public int searchAppVesion() {
		int value=(int) commonDao.listByObject("SELECT value FROM `sys_base`  where bid =4", new RowMapper<Integer>(){
			@Override
			public Integer mapRow(ResultSet arg0, int arg1) throws SQLException {
				return arg0.getInt("value");
			}
			
		});
		return value;
	}
}
